home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_kdelibs.idb / usr / freeware / kde / include / htmlview.h.z / htmlview.h
Encoding:
C/C++ Source or Header  |  1999-01-26  |  28.9 KB  |  953 lines

  1. /* This file is part of the KDE libraries
  2.     Copyright (C) 1997 Martin Jones (mjones@kde.org)
  3.               (C) 1997 Torben Weis (weis@kde.org)
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18.     Boston, MA 02111-1307, USA.
  19. */
  20. //----------------------------------------------------------------------------
  21. //
  22. // KDE HTML Widget
  23. //
  24. // Copyright (c) 1997 The KDE Project
  25. //
  26.  
  27. #ifndef HTMLVIEW_H
  28. #define HTMLVIEW_H
  29.  
  30. #include <qscrbar.h>
  31. #include <qlist.h>
  32. #include <html.h>
  33. #include <drag.h>
  34.  
  35. /**
  36.  * @short Widget for displaying HTML.  Manages srcollbars and frames.
  37.  *
  38.  * This widget makes displaying HTML text very easy. It handles scrollbars
  39.  * and stuff. It is able to handle most HTML 3.x including tables and frames.
  40.  * To fill the widget with content you should do the follwing:
  41.  * <PRE>
  42.  * view->begin( "file:/tmp/test.html" );
  43.  * view->parse();
  44.  * view->write( "<HTML><TITLE>...." );
  45.  * .....
  46.  * view->end();
  47.  * view->show();
  48.  * </PRE>
  49.  * The widget will care for resize events and paint events and for scrolling.
  50.  * Have a look at the set of signals emitted by this widget. You should connect
  51.  * to most of them.
  52.  */
  53. class KHTMLView : public QWidget
  54. {
  55.     Q_OBJECT
  56. public:
  57.     /**
  58.      * Created a new HTML View. The widget is empty by default.
  59.      * You must use @ref #begin, @ref #write, @ref #end and @ref #parse
  60.      * to fill the widget with content.
  61.      *
  62.      * @param _name is the name of the widget. Usually this name is only
  63.      *          meaningful for Qt but in this case it is the name of
  64.      *          the HTML window. This means you can reference this name
  65.      *          in the < href=... target=... > tag. If this argument is 0L
  66.      *          then a unique default name is chosen.
  67.      */
  68.     KHTMLView( QWidget *_parent = 0L, const char *_name = 0L, int _flags = 0,
  69.     KHTMLView *_parent_view = 0L );
  70.     /**
  71.      * Destroys the widget and all of its child widgets.
  72.      */
  73.     virtual ~KHTMLView();
  74.  
  75.     /**
  76.      * Clears the widget and prepares it for new content. If you display
  77.      * for example "file:/tmp/test.html", you can use the following code
  78.      * to get a value for '_url':
  79.      * <PRE>
  80.      * KURL u( "file:/tmp/test.html" );
  81.      * view->begin( u.directoryURL() );
  82.      * </PRE>
  83.      *
  84.      * @param _dx is the initial horizontal scrollbar value. Usually you don't
  85.      *            want to use this.
  86.      * @param _dy is the initial vertical scrollbar value. Usually you don't
  87.      *            want to use this.
  88.      */
  89.     virtual void begin( const char *_url = 0L, int _dx = 0, int _dy = 0 );
  90.  
  91.     /**
  92.      * Writes another part of the HTML code to the widget. You may call
  93.      * this function many times in sequence. But remember: The less calls
  94.      * the faster the widget is.
  95.      */
  96.     virtual void write( const char *_text );
  97.  
  98.     /**
  99.      * Call this after your last call to @ref #write.
  100.      */
  101.     virtual void end();
  102.  
  103.     /**
  104.      * This function will parse the code that has been previously written using
  105.      * the @ref #write function. Call this one after calling @ref #end.
  106.      */
  107.     virtual void parse();
  108.  
  109.     /**
  110.      * Shows '_url' in this view. Usually a @ref #documentRequest signal is
  111.      * emitted to load the url.
  112.      */
  113.     virtual void openURL( const char *_url );
  114.  
  115.     /**
  116.      * Prints this view to the printer.
  117.      */
  118.     virtual void print();
  119.     
  120.     /**
  121.      * Creates a new view. This function is not intended to be called by the
  122.      * application that uses this widget. It is intended to be overloaded by
  123.      * some class. If for example you have done this:
  124.      * <PRE>
  125.      * class MyView : public KHTMLView
  126.      * {
  127.      * ...
  128.      *    virtual KHTMLView* newView( QWidget *_parent, const char *_name, int _flags );
  129.      * };
  130.      * </PRE>
  131.      * You may now want to reimplement like this
  132.      * <PRE>
  133.      * KHTMLView* myView::newView( QWidget *_parent, const char *_name, int _flags );
  134.      * {
  135.      *   return new MyView( ... );
  136.      * }
  137.      * </PRE>
  138.      * This will cause that all frames ( if you have some ) will be an instance
  139.      * of MyView, too.<br>
  140.      * FOR INTERNAL USE ONLY.
  141.      */
  142.     virtual KHTMLView* newView( QWidget *_parent = 0L, const char *_name = 0L, int _flags = 0L );
  143.     
  144.     /**
  145.      * Changes the name of the widget.
  146.      * This name is used in the <a href=.. target=... > tag.
  147.      *
  148.      * @see #findView
  149.      * @see #name
  150.      */
  151.     virtual void setFrameName( const char *_name ) { frameName = _name; }
  152.  
  153.     /**
  154.      * @return the name of this window.
  155.      *
  156.      * @see #setName
  157.      * @see #name
  158.      * @see #findView
  159.      */
  160.     virtual const char* getFrameName() { return frameName.data(); }
  161.  
  162.     /**
  163.      * Tells the widget that it is a frameset
  164.      * This is for internal use only.
  165.      * FOR INTERNAL USE ONLY.
  166.      */
  167.     void setIsFrameSet( bool _frameset );
  168.  
  169.     /**
  170.      * FOR INTERNAL USE ONLY.
  171.      *
  172.      * @return TRUE if the view displays a frameset right now.
  173.      */
  174.     bool isFrameSet();
  175.  
  176.     /**
  177.      * Tells the widget that it is a frame of some frameset.
  178.      * This is for internal use only.
  179.      * FOR INTERNAL USE ONLY.
  180.      */
  181.     void setIsFrame( bool _frame );
  182.  
  183.     /**
  184.      * FOR INTERNAL USE ONLY.
  185.      *
  186.      * @return TRUE if the view displays a frame right now.
  187.      */
  188.     bool isFrame();
  189.  
  190.     /**
  191.      * Find the anchor named '_name'. If the anchor is found, the widget
  192.      * scrolls to the closest position. Returns TRUE if the anchor has
  193.      * been found.
  194.      */
  195.     bool gotoAnchor( const char *_name );
  196.  
  197.     /**
  198.      * Sets the width of the border. This is used to implement the tag
  199.      * <frame frameborder=... > tag. FOR INTERNAL USE ONLY.
  200.      * 
  201.      * @see frameBorder
  202.      */
  203.     void setFrameBorder( int _b ) { frameBorder = _b;  }
  204.  
  205.     /**
  206.      * @return the width of the border in pixels.
  207.      *
  208.      * @see #setFrameBorder
  209.      */
  210.     int getFrameBorder() { return frameBorder; }
  211.  
  212.     /**
  213.      * Tells the widget to show/hide the scrollbars. This function will have
  214.      * effect only when called before @ref #begin. It is used to implement the
  215.      * <tt><frame scrolling=... ></tt> tag.<br>
  216.      * FOR INTERNAL USE ONLY.
  217.      *
  218.      * @param _scroll is 1 for yes, 0 for no and -1 for auto.
  219.      *
  220.      * @see #scrolling
  221.      */  
  222.     void setScrolling( int _scroll ) { scrolling = _scroll;  }
  223.  
  224.     /**
  225.      * @return 1 for yes, 0 for no and -1 for auto.
  226.      *
  227.      * @see #setScrolling
  228.      */
  229.     int getScrolling() { return scrolling; }
  230.   
  231.     /**
  232.      * Tells the widget wether it should be resizeable or not.
  233.      * The widget may still resize. Its only intention is to provide
  234.      * information for @ref HTMLFrameSet. @ref HTMLFrameSet looks at this flag
  235.      * to determine wether the separator between this frame and another one
  236.      * may be moved by the user. It is used to impement the
  237.      * <tt><frame noresize ></tt> tag.<br>
  238.      * FOR INTERNAL USE ONLY.
  239.      */
  240.     void setAllowResize( bool _allow ) { bAllowResize = _allow; }
  241.  
  242.     /**
  243.      * This function is used in @ref HTMLFrameSet. It is for
  244.      * INTERNAL USE ONLY.
  245.      *
  246.      * @return TRUE if the widget may be resized by the user.
  247.      *
  248.      * @see #setAllowResize
  249.      */
  250.     bool allowResize() { return bAllowResize; }
  251.  
  252.     /**
  253.      * Sets the width of the margin. This function is used to implement
  254.      * the <tt><frame marginwidth=... ></tt> tag.<br>
  255.      * FOR INTERNAL USE ONLY.
  256.      */
  257.     void setMarginWidth( int _w );
  258.  
  259.     /**
  260.      * Sets the width of the margin. This function is used to implement
  261.      * the <tt><frame marginheight=... ></tt> tag.<br>
  262.      * FOR INTERNAL USE ONLY.
  263.      */
  264.     void setMarginHeight( int _h );
  265.  
  266.     /**
  267.      * Tells the widget that it has been selected. This will result
  268.      * in a black border around the widget. This happens only if this
  269.      * widget represents a frame.
  270.      * FOR INTERNAL USE ONLY.
  271.      */
  272.     void setSelected( bool _selected );
  273.  
  274.     /**
  275.      * FOR INTERNAL USE ONLY.
  276.      *
  277.      * @return TRUE if this widget represents a frame and if it has been
  278.      *         selected by the user. The selected frame has a black inner
  279.      *         border.
  280.      */
  281.     bool isSelected();
  282.     
  283.     /**
  284.      * FOR INTERNAL USE ONLY.
  285.      *
  286.      * @return the x offset of the widget. You may use this function to remeber
  287.      *          which part of the document the user is currently looking at.
  288.      */
  289.     int xOffset();
  290.  
  291.     /**
  292.      * @return the y offset of the widget. You may use this function to remeber
  293.      *          which part of the document the user is currently looking at.
  294.      */
  295.     int yOffset();
  296.     
  297.     /**
  298.      * Checks out wether there is a URL under the point p and returns a pointer
  299.      * to this URL or 0L if there is none.
  300.      */
  301.     const char* getURL( QPoint & p );
  302.  
  303.     /**
  304.      * Seaerches for a KHTMLView with a specific name as mentioned in the
  305.      * constructor.
  306.      * 
  307.      * @see #setName
  308.      * @see #name
  309.      */
  310.     KHTMLView* findView( const char *_name );
  311.  
  312.     /**
  313.      * @return the view that represents the currently selected frame or 0L
  314.      *         if we dont have frames or a selected one right now.
  315.      */
  316.     virtual KHTMLView* getSelectedView();
  317.  
  318.     /**
  319.      * Select all objects matching the regular expression.
  320.      *
  321.      * @param _select if TRUE then all matching objects are marked, otherwise
  322.      *                they become unmarked.
  323.      */
  324.     virtual void select( QRegExp& _pattern, bool _select );
  325.  
  326.     /**
  327.      * Gets a list of all selected URLs. The list may be Null.
  328.      * You can test this using list.isNull().
  329.      */
  330.     virtual void getSelected( QStrList &_list );
  331.  
  332.     /**
  333.      * Get the text the user has marked.
  334.      *
  335.      * @param _str is the QString which will contain the text the user
  336.      * selected.  The selected text is appended to any text currently in
  337.      * _str.
  338.      */
  339.     virtual void getSelectedText( QString &_str );
  340.  
  341.     /**
  342.      * Has the user selected any text?  Call @ref #getSelectedText to
  343.      * retrieve the selected text.
  344.      *
  345.      * @return true if there is text selected.
  346.      */
  347.      bool isTextSelected() const;
  348.   
  349.     /**
  350.      * This function allows you to customize the behavior of the
  351.      * @ref KHTMLWidget.
  352.      * 
  353.      * @return TRUE if the function handled the event, FALSE otherwise.
  354.      *
  355.      * @see #mousePressedHook
  356.      * @see #mouseReleaseHook
  357.      */
  358.     virtual bool mouseMoveHook( QMouseEvent *_ev );
  359.  
  360.     /**
  361.      * This function allows you to customize the behavior of the
  362.      * @ref KHTMLWidget.
  363.      * 
  364.      * @return TRUE if the function handled the event, FALSE otherwise.
  365.      *
  366.      * @see #mousePressedHook
  367.      * @see #mouseMoveHook
  368.      */
  369.     virtual bool mouseReleaseHook( QMouseEvent *_ev );
  370.  
  371.     /**
  372.      * This function is called if the user presses the mouse. If he clicks on
  373.      * a link you get the URL in '_url'.
  374.      *
  375.      * @param _url is the clicked URL or 0L is there was none.
  376.      * @param _target is the target frame if one is mentioned otherwise 0L.
  377.      * @param _ev the @ref QMouseEvent. The coordinates of the mouse contained
  378.      *            in this event are relational to the upper left corner of the
  379.      *            @ref KHTMLWidget, not to this widget!
  380.      * @param _isselected is TRUE of the URL '_url' is already selected.
  381.      *
  382.      * @return TRUE if the function handled the event, FALSE otherwise.
  383.      *
  384.      * @see #mouseMoveHook
  385.      * @see #mouseReleaseHook
  386.      */
  387.     virtual bool mousePressedHook( const char* _url, const char *_target,
  388.     QMouseEvent *_ev, bool _isselected );
  389.  
  390.     /**
  391.      * This function is called if the user wants to start a DND action.
  392.      * Overload this function and return TRUE to indicate that you processed
  393.      * the event. By default the function returns FALSE. This causes the
  394.      * @ref KHTMLWidget to process the event.
  395.      * Usually this function calls @ref KHTMLWidget::startDrag like this:
  396.      * <TT>view->startDrag(....)</TT>. Dont call the startDrag function of any
  397.      * other window. KDND would not like it :-)
  398.      *
  399.      * @param _url is the URL the user wants to drag around.
  400.      * @param _p is the mouse position in global coordinates.
  401.      */
  402.     virtual bool dndHook( const char *_url, QPoint &_p );
  403.   
  404.     /**
  405.      * Selects all objects in this rectangle and deselects all objects
  406.      * outside the rectangle. 
  407.      *
  408.      * @param _rect is a rectangle in display coordinates. This means
  409.      *              that the point (0,0) is the upper/left most point of
  410.      *              the widget but must not be this one for the HTML page.
  411.      *              This happens if the widget is being scrolled.
  412.      * @param _painter is a @ref QPainter or 0L. If it is 0L a new painter is
  413.      *                 created.
  414.      */
  415.     virtual void select( QPainter * _painter, QRect &_rect );
  416.  
  417.     /**
  418.      * Selects or deselects all objects.
  419.      *
  420.      * @param _painter is a @ref QPainter or 0L. If it is 0L a new painter is
  421.      *                 created.
  422.      */
  423.     virtual void select( QPainter * _painter, bool _select );
  424.  
  425.     /**
  426.      * Selects all objects which refer to '_url'. All selected objects
  427.      * are redrawn if they changed their selection mode.
  428.      *
  429.      * @param _painter may be 0L. In this case a new @ref QPainter is created
  430.      *                 and destroyed afterwards if no painter already exists.
  431.      */
  432.     void selectByURL( QPainter * _painter, const char *_url, bool _select );
  433.   
  434.     /**
  435.      * @return a pointer to the low-level KHTMLWidget.  You may use this
  436.      * to set default colours, etc. supported by the widget.
  437.      *
  438.      * @see #view
  439.      */
  440.     KHTMLWidget* getKHTMLWidget() { return view; }
  441.  
  442.     /**
  443.      * @return the parent KHTMLView of this one or 0L is this is the top level
  444.      * view.
  445.      *
  446.      * @see #parentView
  447.      */
  448.     KHTMLView* getParentView() { return parentView; }
  449.     
  450.     /**
  451.      * Called when a URL is encountered.  Overload this method to indicate
  452.      * which links have been visited previously.
  453.      *
  454.      * @return true if the URL has been visited previously.  If true is
  455.      * returned the URL will be rendered in the vlink color.  If false
  456.      * is returned the URL will be rendered in the link color.
  457.      */
  458.     virtual bool URLVisited( const char * /*_url*/ ) { return false; }
  459.  
  460.     /**
  461.      *
  462.      * Sets charset for the View
  463.      */
  464.     void setCharset( const char *_c); 
  465.     
  466.     /**
  467.      * For internal use only.
  468.      *
  469.      * @see #cookie
  470.      */
  471.     const char* getCookie() { return cookie.data(); }
  472.  
  473.     /**
  474.      * For internal use only.
  475.      *
  476.      * @see #cookie
  477.      */
  478.     void setCookie( const char *_c )
  479.     { printf("Setting cookie '%s'\n",_c); cookie = _c; }
  480.  
  481.     void cancelAllRequests();
  482.  
  483.  
  484. signals:
  485.     /**
  486.      * This signal is emitted if we deal with frames ( or one of the child
  487.      * widgets! ).
  488.      * It tells the owner of the widget to provide a certain URL for a widget.
  489.      * The owner has to call <PRE>
  490.      * _widget->begin( .. );
  491.      * _widget->parse();
  492.      * _widget->write( .. ); ....
  493.      * _widget->end();
  494.      * </PRE>
  495.      * This may happen before returning ( directly after receiving this
  496.      * signal ), or some time later on. You may be notified that the URL
  497.      * is no longer wanted. This is done with the
  498.      * signal @ref #cancelDocumentRequest.
  499.      *
  500.      * @param _widget is the widget that requests the document.
  501.      * @param _url is the URL where the document can be found.
  502.      *
  503.      * @see #cancelDocumentRequest
  504.      * @see #slotDocumentRequest
  505.      */
  506.     void documentRequest( KHTMLView* _widget, const char* _url );
  507.     
  508.     /**
  509.      * This signal is emitted if the widget does not need the document any more.
  510.      *
  511.      * @param _url is the URL of the document that we dont need any more.
  512.      */
  513.     void cancelDocumentRequest( KHTMLView *_view, const char *_url );
  514.  
  515.     /**
  516.      * This signal is emitted whenever the widget wants to
  517.      * change the windows title. Usually this is the text
  518.      * enclosed in the title tag.
  519.      *
  520.      * @param _title is a string of ASCII characters.
  521.      */
  522.     void setTitle( const char *_title );
  523.  
  524.     /**
  525.      * Signals that the URL '_url' has been selected. The user used
  526.      * the mouse button '_button' for this.
  527.      *
  528.      * @param _url is a full qualified URL.
  529.      * @param _button is <tt>LeftButton, MiddleButton or RightButton</tt>
  530.      * @param _target is the target window or 0L if none is specified.
  531.      */
  532.     void URLSelected( KHTMLView *_view, const char *_url, int _button,
  533.     const char *_target );
  534.  
  535.     /**
  536.      * Signals that the mouse cursor is over URL '_url'.
  537.      * If '_url' is null then cursor moved off a URL
  538.      *
  539.      * @param _url is a full qualified URL.
  540.      */
  541.     void onURL( KHTMLView *_view, const char *_url );
  542.  
  543.     /**
  544.      * Signal that the user has selected text or the existing selection has
  545.      * become unselected.  The text may be retrieved using
  546.      * @ref #getSelectedText.  This is a good signal to connect to for
  547.      * enabling/disabling the Copy menu item or calling XSetSelectionOwner().
  548.      *
  549.      * @param _selected is true if the user has selected text or false if
  550.      * the current selection has been removed.
  551.      */
  552.     void textSelected( KHTMLView *_view, bool _selected );
  553.  
  554.     /**
  555.      * This signal is Emitted if the user pressed the right mouse button
  556.      * over an URL. '_url' may be 0L to indicate the the user pressed
  557.      * the right mouse button over an area that does not have an anchor
  558.      * tag.
  559.      *
  560.      * @param _url is a full qualified URL or 0L.
  561.      * @param _point is the position where the user pressed the mouse button.
  562.      *               This point is already in global cooredinates.
  563.      */
  564.     void popupMenu( KHTMLView *_view, const char *_url, const QPoint &_point );
  565.  
  566.     /**
  567.      * This signal is emitted if the widget requests to load an image.
  568.      * KHTMLWidget can only load image from your local disk. If it
  569.      * finds an image with another protocol in its URL, it will emit this
  570.      * signal. If the image is loaded at some time, call @ref #slotImageLoaded.
  571.      * If the image is not needed any more, the signal @ref #cancelImageRequest
  572.      * is emitted. It may happen that not the widget itself but one of its
  573.      * children requests the image. To distibuish that you get '_view'.
  574.      *
  575.      * @see #cancelImageRequest
  576.      */
  577.     void imageRequest( KHTMLView *_view, const char *_url );
  578.  
  579.     /**
  580.      * This signal is only emitted if this widget and not one of its children
  581.      * requests an image.
  582.      */
  583.     void imageRequest( const char *_url );
  584.     
  585.     /**
  586.      * Cancels an image that has been requested before.
  587.      *
  588.      * @see #imageRequest
  589.      */
  590.     void cancelImageRequest( KHTMLView *_view, const char *_url );
  591.  
  592.     /**
  593.      * This signal is only emitted if this widget and not one of its children
  594.      * cancels a requested image.
  595.      */
  596.     void cancelImageRequest( const char *_url );
  597.  
  598.     /**
  599.      * The user pressed a forms submit button.
  600.      *
  601.      * @param _url is the <form action=...> value
  602.      * @param _method is the <form method=...> value
  603.      * @param _data is the encoded data to send 
  604.      */
  605.     void formSubmitted( KHTMLView *_view, const char *_method,
  606.     const char *_url, const char *_data );
  607.  
  608.     /**
  609.      * Emitted if the user presses the mouse button over this widget and if
  610.      * the widget is a frame. In this case this frame became the selected one
  611.      * and this signal is used to tell our parent about this.
  612.      *
  613.      * @see #setSeleced
  614.      */
  615.     void frameSelected( KHTMLView *_view );
  616.  
  617.     /**
  618.      * The widget started working. You may use this signal to implement an
  619.      * animated logo like netscape has one.
  620.      *
  621.      * @see #documentDone
  622.      */
  623.     void documentStarted( KHTMLView *_view );
  624.  
  625.     /**
  626.      * This signal is emitted if the widget has parsed and if all images
  627.      * arrived. Mention that this is only true or '_view'. The parent widget
  628.      * or any child widget may still parse or wait for an image.
  629.      * This signal is the complement to @ref #documentStarted
  630.      */
  631.     void documentDone( KHTMLView *_view );
  632.  
  633.     /**
  634.      * The user pressed ALT + Up
  635.      */
  636.     void goUp( KHTMLView *_view );
  637.     void goUp();
  638.     /**
  639.      * The user pressed ALT + Right
  640.      */
  641.     void goRight( KHTMLView *_view );
  642.     void goRight();
  643.     /**
  644.      * The user pressed ALT + Left
  645.      */
  646.     void goLeft( KHTMLView *_view );
  647.     void goLeft();
  648.   
  649. public slots:
  650.     void slotScrollVert( int _dy );
  651.     void slotScrollHorz( int _dx );
  652.   
  653.     /** Call this slot if an requested image is available.
  654.      * The rquested image is named '_url' and is stored on the local disk
  655.      * in the file named '_filename'.
  656.      *
  657.      * @param _url is the full qualified URL that was passedd to you by the
  658.      *             ref #imageRequest signal.
  659.      * @param _filename is a usual UNIX filename like "/tmp/tmpimage".
  660.      */
  661.     void slotImageLoaded( const char *_url, const char *_filename );
  662.  
  663.     /**
  664.      * This slot is connected to all children. It emits the signal
  665.      * @ref #documentRequest if called. <b>This slot is for internal use
  666.      * only</b>.
  667.      */
  668.     void slotDocumentRequest( KHTMLView* _view, const char* _url );
  669.  
  670.     /**
  671.      * This slot is connected to all children. It emits the signal
  672.      * @ref #cancelDocumentRequest if called. <b>This slot is for internal use
  673.      * only</b>.
  674.      */
  675.     void slotCancelDocumentRequest( KHTMLView* _view, const char* _url );
  676.  
  677.     /**
  678.      * This slot is connected to all children. It emits the signal
  679.      * @ref #URLSelected if called. <b>This slot is for internal use only</b>.
  680.      */
  681.     void slotURLSelected( KHTMLView* _view, const char* _url, int _button,
  682.     const char *_target );
  683.  
  684.     /**
  685.      * This slot is connected to all children. It emits the signal
  686.      * @ref #setTitle if called. <b>This slot is for internal use only</b>.
  687.      */
  688.     void slotSetTitle( const char* _text );
  689.  
  690.     /**
  691.      * This slot is connected to all children. It emits the signal
  692.      * @ref #onURL if called. <b>This slot is for internal use only</b>.
  693.      */
  694.     void slotOnURL( KHTMLView *_view, const char *_url );
  695.  
  696.     /**
  697.      * This slot is connected to all children. It emits the signal
  698.      * @ref #popupMenu if called. <b>This slot is for internal use only</b>.
  699.      */
  700.     void slotPopupMenu( KHTMLView *_view, const char *_url,
  701.     const QPoint &_point );
  702.  
  703.     /**
  704.      * This slot is connected to all children. It emits the signal
  705.      * @ref #imageRequest if called. <b>This slot is for internal use only</b>.
  706.      */
  707.     void slotImageRequest( KHTMLView *_view, const char *_url );
  708.  
  709.     /**
  710.      * This slot is connected to all children. It emits the signal
  711.      * @ref #cancelImageRequest if called. <b>This slot is for internal use
  712.      * only</b>.
  713.      */
  714.     void slotCancelImageRequest( KHTMLView *_view, const char *_url );
  715.  
  716.     /**
  717.      * This slot is connected to all children. It emits the signal
  718.      * @ref #cancelImageRequest if called. <b>This slot is for internal use
  719.      * only</b>.
  720.      *
  721.      * @param _method is the <form method=...> value
  722.      * @param _url is the <form action=...> value
  723.      * @param _data is the encoded from data submitted
  724.      */
  725.     void slotFormSubmitted( KHTMLView *_view, const char *_method,
  726.     const char *_url, const char *_data );
  727.  
  728.     /**
  729.      * This slot is connected to all children. It emits the signal
  730.      * @ref #documentStarted if called. <b>This slot is for internal use
  731.      * only</b>.
  732.      */
  733.     void slotDocumentStarted( KHTMLView *_view );
  734.  
  735.     /**
  736.      * This slot is connected to all children. It emits the signal
  737.      * @ref #documentDone if called. <b>This slot is for internal use only</b>.
  738.      */
  739.     void slotDocumentDone( KHTMLView *_view );
  740.  
  741.     /**
  742.      * You can move the vertical scrollbar by calling this slot.
  743.      */
  744.     void slotVertSubtractLine();
  745.  
  746.     /**
  747.      * You can move the vertical scrollbar by calling this slot.
  748.      */
  749.     void slotVertAddLine();
  750.  
  751.     /**
  752.      * You can move the vertical scrollbar by calling this slot.
  753.      */
  754.     void slotVertSubtractPage();
  755.  
  756.     /**
  757.      * You can move the vertical scrollbar by calling this slot.
  758.      */
  759.     void slotVertAddPage();
  760.  
  761. protected slots:    
  762.  
  763.     /**
  764.      * This slot is connected to @ref KHTMLWidget. It emits the signal
  765.      * @ref #URLSelected if called. <b>This slot is for internal use only</b>.
  766.      */
  767.     virtual void slotURLSelected( const char* _url, int _button,
  768.     const char *_target );
  769.  
  770.     /**
  771.      * This slot is connected to @ref KHTMLWidget. It emits the signal
  772.      * @ref #onURL if called. <b>This slot is for internal use only</b>.
  773.      */
  774.     virtual void slotOnURL( const char *_url );
  775.  
  776.     /*
  777.      * This slot is connected to @ref KHTMLWidget. It emits the signal
  778.      * @ref #textSelected if called.  This slot is for internal use only.
  779.      */
  780.     virtual void slotTextSelected( bool _selected );
  781.  
  782.     /**
  783.      * This slot is connected to @ref KHTMLWidget. It emits the signal
  784.      * @ref #popupMenu if called. <b>This slot is for internal use only</b>.
  785.      */
  786.     virtual void slotPopupMenu( const char *_url, const QPoint &_point );
  787.  
  788.     /**
  789.      * This slot is connected to @ref KHTMLWidget. It emits the signal
  790.      * @ref #imageRequest if called. <b>This slot is for internal use only</b>.
  791.      */
  792.     virtual void slotImageRequest( const char *_url );
  793.  
  794.     /**
  795.      * This slot is connected to @ref KHTMLWidget. It emits the signal
  796.      * @ref #cancelImageRequest if called. <b>This slot is for internal use
  797.      * only</b>.
  798.      */
  799.     virtual void slotCancelImageRequest( const char *_url );
  800.  
  801.     /**
  802.      * This slot is connected to @ref KHTMLWidget. It emits the signal
  803.      * if the form is submitted
  804.      *
  805.      * @param _url is the <form action=...> value
  806.      * @param _method is the <form method=...> value
  807.      * @param _data is the encoded form data submitted 
  808.      */
  809.     virtual void slotFormSubmitted( const char *_url, const char *_method, const char *_data );
  810.  
  811.     /**
  812.      * This slot is connected to @ref KHTMLWidget. It emits the signal
  813.      * if the document in the HTML Widget changes.<br>
  814.      * <b>For Internal use only</b>.
  815.      */
  816.     virtual void slotDocumentChanged();
  817.  
  818.     /**
  819.      * This slot is connected to @ref KHTMLWidget. It emits the signal
  820.      * @ref #documentStarted if called. <b>This slot is for internal use
  821.      * only</b>.
  822.      */
  823.     virtual void slotDocumentStarted();
  824.  
  825.     /**
  826.      * This slot is connected to @ref KHTMLWidget. It emits the signal
  827.      * @ref #documentDone if called. <b>This slot is for internal use only</b>.
  828.      */
  829.     virtual void slotDocumentDone();
  830.        
  831.     /**
  832.      * Connected to the HTML widget.
  833.      */
  834.     void slotInternScrollVert( int );
  835.  
  836.     /**
  837.      * Connected to the HTML widget
  838.      */
  839.     void slotInternScrollHorz( int );
  840.  
  841.     /**
  842.      * The user pressed ALT + Up
  843.      */
  844.     void slotGoUp();
  845.     /**
  846.      * The user pressed ALT + Right
  847.      */
  848.     void slotGoRight();
  849.     /**
  850.      * The user pressed ALT + Left
  851.      */
  852.     void slotGoLeft();
  853.     
  854. protected:
  855.     virtual void resizeEvent( QResizeEvent* _ev );
  856.     virtual void closeEvent( QCloseEvent *e );
  857.  
  858.     virtual void initGUI();
  859.  
  860.     /*
  861.      * Determiens wether scrollbars are needed and displays or hides them
  862.      */
  863.     virtual void calcScrollBars();
  864.   
  865.     /*
  866.      * The horizontal scrollbar
  867.      */    
  868.     QScrollBar *horz;
  869.  
  870.     /*
  871.      * The vertical scrollbar
  872.      */    
  873.     QScrollBar *vert;
  874.  
  875.     /*
  876.      * The HTML Widget.
  877.      */
  878.     KHTMLWidget *view;
  879.  
  880.     /**
  881.      * The currently displayed URL.
  882.      * This is usually the same URL as the one passed to the Constructor of
  883.      * @ref KIDWIindow::KIDWindow.
  884.      */
  885.     QString url;
  886.  
  887.     /*
  888.      * Flag that indicates wether we show a horizontal scrollbar.
  889.      *
  890.      * @see horz
  891.      */
  892.     bool displayHScroll;
  893.  
  894.     /*
  895.      * Flag that indicates wether we show a vertictal scrollbar.
  896.      *
  897.      * @see vert
  898.      */
  899.     bool displayVScroll;
  900.  
  901.     /*
  902.      * List of all open html views.
  903.      */
  904.     static QList<KHTMLView> *viewList;
  905.  
  906.     /*
  907.      * The name of the window. You can refer to this name in the
  908.      * <a href=... target=... >> tag.
  909.      *
  910.      * @see #findView
  911.      * @see #setName
  912.      * @see #getName
  913.      */
  914.     QString frameName;
  915.  
  916.     /*
  917.      * @see #setAllowResize
  918.      */
  919.     bool bAllowResize;
  920.  
  921.     /*
  922.      * @see #setScrolling
  923.      */
  924.     int scrolling;
  925.  
  926.     /*
  927.      * @see #setFrameBorder
  928.      */
  929.     int frameBorder;
  930.  
  931.     /*
  932.      * Pointer to the parent KHTMLView. If this view is the toplevel frame or
  933.      * if there are no frames at all then this pointer is 0L.
  934.      */
  935.     KHTMLView *parentView;
  936.  
  937.     /*
  938.      * This string holds some temporary data. It is used by @ref KHTMLWidget
  939.      *
  940.      * @see #setCookie
  941.      * @see #getCookie
  942.      */
  943.     QString cookie;              
  944.  
  945.     int scrollToX;
  946.     int scrollToY;
  947. };
  948.  
  949. #endif
  950.  
  951.  
  952.  
  953.